
header {
    #include <sstream>
    #include <iostream>
    #include <Oz/Mpl/UnicodeCharBuffer.hpp>
    #include <Oz/Mpl/UnicodeCharScanner.hpp>
}

options {
    language="Cpp";
}

class MplLexer extends Lexer("UnicodeCharScanner");

options {
    k = 8;
    // Allow any char but \uFFFF (16 bit -1)
    // hmmm antlr does not allow \u10FFFE
    charVocabulary='\u0000'..'\uFFFE';
    exportVocab=Mpl;
    testLiterals = true;
    noConstructors = true;
}

{
public:
    bool done;

    MplLexer( std::istream& in ) : UnicodeCharScanner(new UnicodeCharBuffer(in),true){
        initLiterals();
    }
    MplLexer( UnicodeCharBuffer& ib ) : UnicodeCharScanner(ib,true){
        initLiterals();
    }
    void uponEOF(){
        done = true;
    }
}


CLASSKEYWORD: 'c' 'l' 'a' 's' 's';

INTERFACEKEYWORD: 'i' 'n' 't' 'e' 'r' 'f' 'a' 'c' 'e';

EXEPTIONKEYWORD: 'e' 'x' 'c' 'e' 't' 'i' 'o' 'n';

MODULEKEYOWRD: 'm' 'o' 'd' 'u' 'l' 'e';

USECASEKEYWORD: 'u' 's' 'e' 'c' 'a' 's' 'e';

ACTORKEYWORD: 'a' 'c' 't' 'o' 'r';

ACTIONKEYWORD: 'a' 'c' 't' 'i' 'o' 'n';

MPLINT: 'i' 'n' 't';

MPLSTRING: 's' 't' 'r' 'i' 'n' 'g';

MPLUUID: 'u' 'u' 'i' 'd';

MPLFLOAT: 'f' 'l' 'o' 'a' 't';

MPLLONG: 'l' 'o' 'n' 'g';

MPLBYTE: 'b' 'y' 't' 'e';

QUESTION        :   '?'     ;
LPAREN      :   '('     ;
RPAREN      :   ')'     ;
LBRACK      :   '['     ;
RBRACK      :   ']'     ;
LCURLY      :   '{'     ;
RCURLY      :   '}'     ;
COLON           :   ':'     ;
SEMI            :   ';'     ;
ASSIGN      :   '='     ;


WS : ' '|'\t';

NEWLINE options{generateAmbigWarnings=false;}: '\r' | '\n';

IDENT
    options {testLiterals=true;}
    :   ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
    ;